/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Correo;

import java.util.LinkedList;
import java.util.StringTokenizer;

/**
 *
 * @author estudiante
 */
public class MailParser {

    private LinkedList<String> vectAttrib = new LinkedList<String>();

    public void parsearAtributos(String dato) {
        try {
            vectAttrib.clear();
            if (dato != null) {
                StringTokenizer parser = new StringTokenizer(dato, ";");
                while (parser.hasMoreTokens()) {
                    String attrib = parser.nextToken().split("=")[1].trim();
                    vectAttrib.add(attrib);
                }
            }
        } catch (Exception e) {
            vectAttrib.clear();
        }

    }

    public String nextAtributo() {
        String s = vectAttrib.getFirst();
        vectAttrib.removeFirst();
        return s;
    }

    public LinkedList<String> getVectAttrib() {
        return vectAttrib;
    }

    public static void main(String[] args) {
        String atributos = "registro = 1111; nombre = angel; direccion = dir1; fecha= 05-06-2008 ";
        MailParser parser = new MailParser();
        parser.parsearAtributos(atributos);
        System.out.println(parser.getVectAttrib());
    }
}
